﻿using System;
using System.Xml.Serialization;

namespace LaunchPad.Core
{
    public class IdRef<T> : IIdentifiable where T : IIdentifiable
    {
        public IdRef() { }

        public IdRef(T referencedItem)
        {
            Id = referencedItem.Id;

            if (referencedItem is INameable)
                NameHint = (referencedItem as INameable).Name;
        }

        [XmlAttribute]
        public Guid Id { get; set; }

        [XmlAttribute]
        public string NameHint { get; set; }
    }
}
